package com.example.asynctasklession1;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.example.asynctask.TestAsynctTask;

public class MainActivity extends Activity {

	
	private TextView tv_content;
	private Button btn_click;
	private ProgressBar pb_update;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		tv_content = (TextView) this.findViewById(R.id.textView1);
		btn_click = (Button) this.findViewById(R.id.button1);
		pb_update = (ProgressBar) this.findViewById(R.id.progressBar1);
		final TestAsynctTask asynctask = new TestAsynctTask(tv_content, pb_update);
		btn_click.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				asynctask.execute();
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
